Here, we have a thread solely responsible for processing a nonblocking channel (the producer) and another thread solely responsible for consuming the data as a stream (the consumer).
这里,我们让一个线程单独负责处理非阻塞通道(生产者),让另一个线程单独负责把数据作为流消费(消费者)。
So, if a thread is blocked in an I/O operation on a channel, another thread can close that channel.
所以,如果一个线程在某条通道的 I/O 操作上阻塞时,那么另一个线程可以将这条通道关闭。
As the nonblocking channel is read, it is written into a pipe that is being consumed by a second thread.
当读取非阻塞通道时,把它写到正由第二个线程消费的管道。
应用推荐